package com.example.yinweiapplication.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;

import com.example.yinweiapplication.R;

import java.util.List;
import java.util.Map;

/**
 * Created by lintao on 2015/7/6.
 */
public class ContantsAdapter extends BaseExpandableListAdapter {

    private Map<String,Integer> map;
    private List<List<String>> childText;

    private FlowLayout flowLayout;
    private LayoutInflater inflater;
    public ContantsAdapter(Context context,Map<String,Integer> map, List<List<String>> childText) {

        this.map = map;
        this.childText = childText;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getGroupCount() {
        return map==null?0:map.size();
    }

    @Override
    public int getChildrenCount(int groupPosition) {
        return groupPosition;
    }

    @Override
    public Object getGroup(int groupPosition) {
        return map.get(groupPosition);
    }

    @Override
    public Object getChild(int groupPosition, int childPosition) {
        return childText.get(groupPosition).get(childPosition);
    }

    @Override
    public long getGroupId(int groupPosition) {
        return groupPosition;
    }

    @Override
    public long getChildId(int groupPosition, int childPosition) {
        return childPosition;
    }



    @Override
    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {

        return null;
    }

    @Override
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
        if(convertView==null){
            convertView = inflater.inflate(R.layout.search_item_flayout, null);
            flowLayout= (FlowLayout) convertView.findViewById(R.id.flow_layout);


        }
        return null;
    }

    @Override
    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return true;
    }
    @Override
    public boolean hasStableIds() {
        return false;
    }
}
